# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Hinata Yanagi <hinasssan@gmail.com>
# Maintainer: Hinata Yanagi <hinasssan@gmail.com>
pkgname=tcc
pkgver=0.9.27_git20220323
_commit="750f0a3e3f11c1a442f00f017c2548a8f63e0b9f"
pkgrel=1
pkgdesc="Tiny C Compiler"
url="https://repo.or.cz/w/tinycc.git"
arch="all !ppc64le !s390x"
license="LGPL-2.1-or-later"
makedepends="texinfo"
options="!check" # test suite currently fails on the server
depends_dev="$pkgname-libs"
source="
	$pkgname-$_commit.tar.gz::https://repo.or.cz/tinycc.git/snapshot/$_commit.tar.gz
	libtcc.pc.in
	"
subpackages="
	$pkgname-libs
	$pkgname-libs-static
	$pkgname-dev
	$pkgname-doc
	"
builddir="$srcdir/tinycc-${_commit:0:7}"

build() {
	./configure \
		--prefix=/usr \
		--disable-static \
		--config-musl
	make

	sed 's/@VERSION@/'"$pkgver"'/' "$srcdir"/libtcc.pc.in > libtcc.pc
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 libtcc.pc -t "$pkgdir"/usr/lib/pkgconfig/
	install -Dm644 Changelog CodingStyle README TODO \
		-t "$pkgdir"/usr/share/doc/$pkgname
}

libs() {
	default_libs
	amove usr/lib/libtcc.so
}

sha512sums="
cad277e8643d2402e204290e42ecef559e8bc1259e0405ed7e1b4367f54702fd3167c10314ab81dcc9f6dd08852489053d2e7f662ddcfdd1f3c36549b9c796f6  tcc-750f0a3e3f11c1a442f00f017c2548a8f63e0b9f.tar.gz
3e6311ef2b93ef5bcc17eb33077e2d79526c1592bb28189d1d12f1835d3af8234fe33cf49372c3c9ca703bb7cebebbdbbeb3db9864e18a76510e67b52b173e3a  libtcc.pc.in
"
